bool isValid(char* s) {
    int n = strlen(s);
    if (n % 2 == 1) {
        return false;
    }
    int top = 0;
    char skt[n+1];
    for (int i = 0; i < n; i++) {
       if(s[i]=='{'||s[i]=='['||s[i]=='('){
         top++;
         skt[top]=s[i];
       }else{
         if((s[i]=='}'&&skt[top]=='{')||(s[i]==']'&&skt[top]=='[')||(s
         [i]==')'&&skt[top]=='(')){
           top--;
         }else{
           return false;
         }
         }
       }
    
    if(top==0) {
      return true;
    }
    return false;
}
